home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F24004_Company1MPull.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-10-04  |  2.4 KB  |  67 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- ===========================================================
  3.   Category:       OneToMany
  4.   Author:         David Silverlight
  5.                   HeadGeek@xmlpitstop.com
  6.   Created:        2001-05-16
  7.   Description:-
  8.     This stylsheet demonstrates a basic 1 to many relationship
  9.     of Company to Employees. Also note that we are using the
  10.     Pull method to extract data from our xml document. The pull
  11.     method is an approach where the use of templates is
  12.     minimized and data is  accessed by 'pulling' it from our xml
  13.     document
  14. ================================================================ -->
  15. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  16.   <xsl:output method="html" />
  17.  
  18.   <xsl:template match="/">
  19.     <html>
  20.       <head>
  21.         <title>Stylesheet Example</title>
  22.         <style type="text/css"><![CDATA[
  23.         H1 {COLOR: red; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  24.         H2 {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  25.         .head {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  26.         .subhead {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  27.         .text {COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  28.         TH {COLOR: white; FONT-FAMILY: Arial; background-color: darkblue;}
  29.         TD {COLOR: darkblue; FONT-FAMILY: Arial}
  30.         TR { background-color: beige; }
  31.         BODY { background-color: beige; }
  32.         ]]></style>
  33.       </head>
  34.       <body>
  35.         <h1>Company Information for Infoteria</h1>
  36.         <span class="subhead">Employee Listing</span>
  37.         <BR />
  38.         <table border="1">
  39.           <tr>
  40.             <th>Name</th>
  41.             <th>Position</th>
  42.             <th>Email</th>
  43.           </tr>
  44.           <xsl:for-each select="Company/Employee">
  45.             <tr>
  46.               <td>
  47.                 <xsl:value-of select="FirstName" />
  48.                 <xsl:value-of select="LastName" />
  49.               </td>
  50.               <td>
  51.                 <xsl:value-of select="Position" />
  52.               </td>
  53.               <td>
  54.                 <xsl:value-of select="Email" />
  55.               </td>
  56.             </tr>
  57.           </xsl:for-each>
  58.         </table>
  59.         <span class="text">
  60.         <br />
  61.         Total Employees:
  62.         <xsl:value-of select="count(Company/Employee)" />
  63.         </span>
  64.       </body>
  65.     </html>
  66.   </xsl:template>
  67. </xsl:stylesheet>